using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace eBirdAttend
{
    public partial class DeleteTransactionsFrmDevice : Form
    {
        public string _strPort = "";
        
        eOfficeTrans _eOfficeTrans;
        int _Close;
        public DeleteTransactionsFrmDevice()
        {
            InitializeComponent();
            _Close = 1;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            _strPort = cmbPort.SelectedItem.ToString();          
            _eOfficeTrans = new eOfficeTrans();
            _eOfficeTrans.Init();
            _eOfficeTrans.SetTextBox(richTextStatus);
            _eOfficeTrans.SetLogFile("TransDelete.txt");

            if (!_eOfficeTrans.OpenPort(_strPort))
            {
                MessageBox.Show("Failed to open port,Close e-OfficeDownLoad Application and try again", "Port Open failed");
                return;
            }
            _eOfficeTrans.SetTimeOut(30);//time out set as 5 sec
            int j=0;
            _Close = 0;
            
            
            string strRep = "";
            string DevCmd = "RS 1\r\n";
            //MessageBox.Show("Swipe card after closing this messagebox", "Enroll Card");
            _eOfficeTrans.SendCommand(DevCmd, ref strRep);
            _eOfficeTrans.Close();
            //timer1.Stop();
           // labelMesg.Visible = false;
        }

        private void DeleteTransactionsFrmDevice_Load(object sender, EventArgs e)
        {
            cmbPort.ResetText();
            //cmbPort.SelectedIndex = int.Parse(Properties.Settings.Default["PORT"].ToString());

        }

        private void button1_Click(object sender, EventArgs e)
        {
            _Close = 1;
            this.Close(); 
        }
    }
}